<?php

use common\widgets\pages\CustomTabs as Tabs;
use yii\helpers\Html;
use yii\helpers\Inflector;

/* @var $this yii\web\View */
/* @var $form yii\widgets\ActiveForm */
/* @var $formModel yii\base\Model */
/* @var $model yii\base\Model */
/* @var $dataProvider yii\data\ActiveDataProvider */
/* @var common\widgets\pages\FormViewPage $_page */

$model = $_page->formModel;

$_o = new ReflectionClass($model);
$methodLabelMap = [
    $_o->getconstant("SCENARIO_CREATE") => "新增",
    $_o->getconstant("SCENARIO_UPDATE") => "更新",
];

$this->title = $_page->pageTitle;
$this->params['subtitle'] = $methodLabelMap[$_page->method];
$this->params['breadcrumbs'] = [
    $_page->pageTitle,
];

$tabContent = $formContent;
$tabsConfig = $_page->tabs;
$tabsConfig['items'][0]['content'] = $tabContent;
$content = Tabs::widget($tabsConfig);

echo Html::tag("div",
    Html::tag("div", $content, ['class' => "col-xs-12 " . Inflector::slug($model->className()) . "grid-view"])
    , ['class' => "row"]);
